#!/sbin/openrc-run
name=nullmailer
description="Nullmailer relay-only MTA"

command=/usr/sbin/nullmailer-send
command_user=nullmailer:nullmailer
command_background=true
pidfile=/run/nullmailer.pid

depend() {
	use net logger
}

checkconfig() {
	local error=0
	local f
	for f in failed queue tmp; do
		install -dm 0750 -o nullmailer /var/spool/nullmailer/$f
	done
	local f=/var/spool/nullmailer/trigger
	if [ ! -p "$f" ]; then
		mkfifo -m660 "$f"
		chown nullmailer:mail "$f"
	fi
}

start_pre() {
	checkconfig
}

